<?php

namespace app\common\model;

use think\Model;

/**
 * 省市区模型
 */
class Region Extends Model
{


    /**
     * @param $level 级别
     * @return array
     */
    public function getList($level){

        $list = $this->field('id,name')->where(['level' => $level])->cache('__Region__')->select();
        $data = [];
        foreach($list as $k => $v){
            $data[$v['id']] = $v['name'];
        }

        return $data;
    }

    

}